def is_prime(num):
    if num < 2:
        return False
    else:
        for i in range(2, num):
            if num % i == 0:
                return False, i
        return True

def the_primes(low, limit):
    beforeprime = []
    primelist = []
    nums = [x for x in range(low, limit+1)]
    for i in nums:
        for j in range(2, i):
            if i % j == 0:
                if i not in primelist:
                    beforeprime.append(i)
        if i not in beforeprime:
            primelist.append(i)
    if len(primelist) != 0:
        return primelist
    else:
        return "There are no primes in this list"

def check_primes():
    primelist = the_primes(int(raw_input("Lower limit: ")), int(raw_input("Upper limit: ")))
    badprimes = []
    for i in primelist:
        if is_prime(i) == False:
            badprimes.append(i)
    print primelist
    if len(badprimes) == 0:
        return "No bad primes"
    else:
        return badprimes, "are bad"
    
answer = raw_input("Generate or Check for primes? G/C ")
if answer.lower() == 'g':
    print check_primes()
elif answer.lower() == 'c':
    print is_prime(input("Which number would you like to check? "))